//
//  KDBaseSectionHeadView.m
//  PublicSentimentMonitorSystem
//
//  Created by 魏强 on 15/6/20.
//  Copyright (c) 2015年 魏强. All rights reserved.
//

#import "KDBaseSectionHeadView.h"
#import "KDBaseSectionHeadModel.h"
@interface KDBaseSectionHeadView ()
@property (weak, nonatomic) IBOutlet UIButton *headSectionBtn;
/**
 *  右进入箭头
 */
@property (weak, nonatomic) IBOutlet UIImageView *arrowView;

@end
@implementation KDBaseSectionHeadView

+ (instancetype)baseSectionHeadView
{
    KDBaseSectionHeadView *baseSectionHeadView = [[[NSBundle mainBundle] loadNibNamed:@"KDBaseSectionHeadView" owner:nil options:nil]lastObject];
    baseSectionHeadView.backgroundColor = WQColor(241, 243, 244);
    baseSectionHeadView.headSectionBtn.layer.cornerRadius = 5.0f;
    [baseSectionHeadView.headSectionBtn.imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    return baseSectionHeadView;
}
- (void)setModel:(KDBaseSectionHeadModel *)model
{
    _model = model;
    self.arrowView.hidden = !model.isSingele;
    [self.headSectionBtn setImage:[UIImage imageNamed:model.iconName] forState:UIControlStateNormal];
    [self.headSectionBtn setTitle:model.titleName forState:UIControlStateNormal];
    self.headSectionBtn.enabled = model.isSingele;
    [self layoutIfNeeded];
}
- (IBAction)headSectionBtnClick:(UIButton *)sender {
    if (_delegate &&[_delegate respondsToSelector:@selector(baseSectionHeadViewClick:)]) {
        [_delegate baseSectionHeadViewClick:self];
    }
}


@end
